
import java.util.Scanner;
public class Main{

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt(),r = sc.nextInt();
        int tmp = l;
        int cout = 0;
        while(tmp>= l &&tmp<=r)
        {
            int cmp = tmp;
            while(cmp!=0)
            {
                if(cmp%10==2)
                    cout++;
                cmp= cmp/10;

            }
            tmp++;
        }
        System.out.print(cout);
    }
}